{$CLEO .cs}
{$USE CLEO+}
{$USE Audio}
{$USE newOpcodes}
{$USE ini}

0000: NOP 

script_name "StRake"

// By ArtemQa146

wait 500

:LoadedModels
wait 500
0AF0: 1@ = read_int_from_ini_file "cleo\StreetCleaners.ini" section "Models" key "Loaded2"
if
1@ == 1
jf @LoadedModels
1@ = 0 
0AF1: write_int 1@ to_ini_file "cleo\StreetCleaners.ini" section "Models" key "Loaded2"

0AF0: 0@ = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Settings" key "Street Cleaners"
if
    0@ == 0
then
    0A93: terminate_this_custom_script
end

0AF0: 6@ = read_int_from_ini_file "cleo\Busy Pedestrians.ini" section "Street Cleaners" key "Ped ID Rake"
0AF0: 31@ = read_int_from_ini_file "cleo\StreetCleaners.ini" section "Models" key "Rake"

if
    6@ <= 0
then
    6@ = 136
end

// 1@ actor
// 0@ render
// 5@ particle
// 6@ Ped ID from ini

:Rake
wait 150
if 
   Player.Defined($PLAYER_CHAR)
jf @Rake
if and
$ACTIVE_INTERIOR == 0  
$ONMISSION == 0 
jf @Rake
0D59: get_current_weather_to 3@
0E40: get_current_hour 2@
if and
not 3@ == 8 // not weather rain 
not 3@ == 16 // not weather rain 2
2@ >= 6
14 > 2@
jf @Rake

// LS

:Rake_Coords_1 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1199.6245 -2044.8295 69.0078 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1199.6245 -2044.8295 69.0078 radius 50.0
jf @Rake_Coords_2
// coords to walk 
10@ = 1199.6245
11@ = -2044.8295
12@ = 69.0078

13@ = 1190.8015
14@ = -2057.1118
15@ = 69.0078

16@ = 1161.5665
17@ = -2046.4989
18@ = 69.0078

19@ = 1150.7046
20@ = -2058.7454
21@ = 69.0078

22@ = 1161.1238
23@ = -2026.7848
24@ = 69.0078

25@ = 1194.2712
26@ = -2020.0646
27@ = 69.0078

28@ = 1144.4465
29@ = -2045.4922
30@ = 69.0078
jump @Rake_Start

:Rake_Coords_2 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1230.879 -1370.7495 13.4059 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1230.879 -1370.7495 13.4059 radius 50.0
jf @Rake_Coords_3
// coords to walk 
10@ = 1230.879
11@ = -1370.7495
12@ = 13.4059

13@ = 1241.0735
14@ = -1368.5299
15@ = 13.4922

16@ = 1223.9045
17@ = -1360.3457
18@ = 13.4922

19@ = 1224.3295
20@ = -1345.6669
21@ = 13.4922

22@ = 1240.5746
23@ = -1343.2819
24@ = 13.4922

25@ = 1219.9923
26@ = -1379.7336
27@ = 13.4922

28@ = 1242.8374
29@ = -1381.6582
30@ = 13.4922
jump @Rake_Start

:Rake_Coords_3 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1919.8368 -1177.5114 22.1455 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1919.8368 -1177.5114 22.1455 radius 50.0
jf @Rake_Coords_4
// coords to walk 
10@ = 1919.8368
11@ = -1177.5114
12@ = 22.1455

13@ = 1920.6793
14@ = -1195.4769
15@ = 20.3203

16@ = 1921.5836
17@ = -1209.8739
18@ = 19.8776

19@ = 1900.495
20@ = -1213.9764
21@ = 18.4183

22@ = 1882.5239
23@ = -1192.8643
24@ = 21.7926

25@ = 1868.0652
26@ = -1196.4462
27@ = 22.536

28@ = 1873.502
29@ = -1211.8938
30@ = 19.0725
jump @Rake_Start

:Rake_Coords_4 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 424.534 -1521.972 30.8872 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 424.534 -1521.972 30.8872 radius 50.0
jf @Rake_Coords_5
// coords to walk 
10@ = 424.534
11@ = -1521.972
12@ = 30.8872

13@ = 427.3901
14@ = -1507.5566
15@ = 31.119

16@ = 429.6129
17@ = -1536.4547
18@ = 29.4329

19@ = 407.3883
20@ = -1516.0889
21@ = 31.6896

22@ = 410.3005
23@ = -1524.0892
24@ = 31.1198

25@ = 409.2932
26@ = -1512.5612
27@ = 31.7675

28@ = 423.9976
29@ = -1498.1733
30@ = 31.1682
jump @Rake_Start

:Rake_Coords_5 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 777.5192 -1302.2958 13.5597 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 777.5192 -1302.2958 13.5597 radius 50.0
jf @Rake_Coords_6 
// coords to walk 
10@ = 777.5192
11@ = -1302.2958
12@ = 13.5597

13@ = 764.9858
14@ = -1300.7828
15@ = 13.5625

16@ = 756.5582
17@ = -1288.2706
18@ = 13.5625

19@ = 756.3403
20@ = -1263.6639
21@ = 13.5625

22@ = 769.8163
23@ = -1260.9849
24@ = 13.5625

25@ = 746.4395
26@ = -1260.0719
27@ = 13.5625

28@ = 732.5361
29@ = -1301.1687
30@ = 13.5625
jump @Rake_Start

:Rake_Coords_6 
wait 100
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 596.7448 -1836.8264 5.6617 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 596.7448 -1836.8264 5.6617 radius 50.0
jf @Rake_Coords_7 
// coords to walk 
10@ = 596.7448
11@ = -1836.8264
12@ = 5.6617

13@ = 607.3273 
14@ = -1840.3647
15@ = 5.652

16@ = 615.8489 
17@ = -1834.7355
18@ = 5.8467

19@ = 623.0666 
20@ = -1840.0081
21@ = 5.6874

22@ = 636.522  
23@ = -1842.2087
24@ = 5.6208

25@ = 641.9819  
26@ = -1833.7113
27@ = 5.9416

28@ = 647.7401  
29@ = -1843.9633
30@ = 5.8109
jump @Rake_Start 


// LS Country

:Rake_Coords_7 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2270.4216 -43.4281 26.5024 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2270.4216 -43.4281 26.5024 radius 50.0
jf @Rake_Coords_8
// coords to walk 
10@ = 2270.4216  
11@ = -43.4281
12@ = 26.5024

13@ = 2273.1162  
14@ = -54.5476
15@ = 26.539

16@ = 2264.3074  
17@ = -54.5921
18@ = 26.5061

19@ = 2254.5244  
20@ = -61.4259
21@ = 26.5059

22@ = 2245.335  
23@ = -57.3402
24@ = 26.5049

25@ = 2242.188   
26@ = -43.7416
27@ = 26.4812

28@ = 2236.8865  
29@ = -56.2969
30@ = 26.479
jump @Rake_Start


// SF

:Rake_Coords_8 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2645.8337 -278.0642 7.4843 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2645.8337 -278.0642 7.4843 radius 50.0
jf @Rake_Coords_9
// coords to walk 
10@ = -2645.8337   
11@ = -278.0642
12@ = 7.4843

13@ = -2634.3462   
14@ = -280.711
15@ = 7.5185

16@ = -2653.749   
17@ = -271.7463
18@ = 7.5018

19@ = -2661.3081    
20@ = -261.1488
21@ = 7.2046

22@ = -2649.9946  
23@ = -257.1776
24@ = 7.0242

25@ = -2644.658    
26@ = -247.7193
27@ = 6.2156

28@ = -2634.135   
29@ = -258.1471
30@ = 6.4304
jump @Rake_Start


:Rake_Coords_9 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2395.5461 -15.2525 35.3125 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2395.5461 -15.2525 35.3125 radius 50.0
jf @Rake_Coords_10
// coords to walk 
10@ = -2395.5461     
11@ = -15.2525
12@ = 35.3125

13@ = -2389.7854     
14@ = -5.5284
15@ = 35.3125

16@ = -2402.8191    
17@ = 0.4903
18@ = 35.3203

19@ = -2408.1865     
20@ = -15.4445
21@ = 35.3203

22@ = -2405.9036    
23@ = -34.1098
24@ = 35.3203

25@ = -2398.9285      
26@ = -43.6655
27@ = 35.3203

28@ = -2388.6362   
29@ = -48.3965
30@ = 35.3203
jump @Rake_Start


:Rake_Coords_10 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -1925.6039 1122.9908 48.463 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -1925.6039 1122.9908 48.463 radius 50.0
jf @Rake_Coords_11
// coords to walk 
10@ = -1925.6039       
11@ = 1122.9908
12@ = 48.463

13@ = -1918.6923       
14@ = 1110.7273
15@ = 48.2568

16@ = -1907.7173      
17@ = 1117.5275
18@ = 46.5416

19@ = -1908.4746      
20@ = 1135.1014
21@ = 46.1091

22@ = -1915.8428    
23@ = 1149.964
24@ = 45.9794

25@ = -1933.1262       
26@ = 1151.4889
27@ = 46.4337

28@ = -1944.4724     
29@ = 1142.1302
30@ = 48.2569
jump @Rake_Start

:Rake_Coords_11 
wait 100
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -1520.7279 -405.9684 7.0781 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -1520.7279 -405.9684 7.0781 radius 50.0
jf @Rake_Coords_12 
// coords to walk 
10@ = -1520.7279       
11@ = -405.9684
12@ = 7.0781

13@ = -1528.6586      
14@ = -393.2247
15@ = 6.9916

16@ = -1515.2772     
17@ = -391.5703
18@ = 7.0781

19@ = -1502.2356     
20@ = -409.0072
21@ = 6.9796

22@ = -1490.8947  
23@ = -423.522
24@ = 6.882

25@ = -1478.048      
26@ = -420.5705
27@ = 6.875

28@ = -1480.3672     
29@ = -402.5909
30@ = 6.875
jump @Rake_Start

:Rake_Coords_12 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2793.5857 1006.2422 49.7635 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2793.5857 1006.2422 49.7635 radius 50.0
jf @Rake_Coords_13 
// coords to walk 
10@ = -2793.5857        
11@ = 1006.2422
12@ = 49.7635 

13@ = -2786.5225       
14@ = 997.4912
15@ = 51.0554

16@ = -2782.5117      
17@ = 984.4069
18@ = 51.8845

19@ = -2795.0337      
20@ = 981.2296
21@ = 49.718

22@ = -2806.4675   
23@ = 985.9873
24@ = 48.1612

25@ = -2814.3506        
26@ = 995.5938
27@ = 47.7312

28@ = -2808.7214     
29@ = 1008.3901
30@ = 47.8866 
jump @Rake_Start


// LV

:Rake_Coords_13 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2325.6006 2318.0237 10.8203 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2325.6006 2318.0237 10.8203 radius 50.0
jf @Rake_Coords_14
// coords to walk 
10@ = 2325.6006          
11@ = 2318.0237
12@ = 10.8203 

13@ = 2309.1116       
14@ = 2318.2256
15@ = 10.8203

16@ = 2305.48        
17@ = 2333.6045
18@ = 10.8203

19@ = 2336.9114       
20@ = 2345.0962
21@ = 10.8203

22@ = 2326.6189   
23@ = 2333.458
24@ = 10.8203 

25@ = 2325.9302         
26@ = 2290.8618
27@ = 10.8203

28@ = 2308.7791      
29@ = 2284.8264
30@ = 10.8203 
jump @Rake_Start

:Rake_Coords_14 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1500.4542 2735.3933 10.8203 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 1500.4542 2735.3933 10.8203 radius 50.0
jf @Rake_Coords_15
// coords to walk 
10@ = 1500.4542            
11@ = 2735.3933
12@ = 10.8203 

13@ = 1489.3069        
14@ = 2729.4592
15@ = 10.8203

16@ = 1476.9949         
17@ = 2731.4006
18@ = 10.8203

19@ = 1468.0442        
20@ = 2737.0583
21@ = 10.8203

22@ = 1483.4275    
23@ = 2760.585
24@ = 10.8203 

25@ = 1515.5376          
26@ = 2756.854
27@ = 10.8203

28@ = 1528.4048       
29@ = 2751.4495
30@ = 10.8203 
jump @Rake_Start

:Rake_Coords_15 
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2126.3218 1668.1095 10.8203 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos 2126.3218 1668.1095 10.8203 radius 50.0
jf @Rake_Coords_16
// coords to walk 
10@ = 2126.3218             
11@ = 1668.1095
12@ = 10.8203 

13@ = 2114.6526        
14@ = 1670.7284
15@ = 10.8203

16@ = 2105.928          
17@ = 1659.3701
18@ = 10.8203

19@ = 2097.6433         
20@ = 1659.2159
21@ = 10.8203

22@ = 2095.6851     
23@ = 1668.2988
24@ = 10.8203 

25@ = 2097.3381           
26@ = 1697.2493
27@ = 10.8203

28@ = 2112.8953        
29@ = 1700.2493
30@ = 10.8203 
jump @Rake_Start

:Rake_Coords_16 
wait 100
if and
0EEA: locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2340.2402 2350.2959 5.1433 radius 100.0
not locate_char_distance_to_coordinates $PLAYER_ACTOR pos -2340.2402 2350.2959 5.1433 radius 50.0
jf @Rake
// coords to walk 
10@ = -2340.2402               
11@ = 2350.2959
12@ = 5.1433 

13@ = -2330.2424         
14@ = 2353.7898
15@ = 4.9929

16@ = -2326.8083          
17@ = 2365.3054
18@ = 5.1883

19@ = -2315.6951           
20@ = 2364.2585
21@ = 5.2133

22@ = -2307.9045      
23@ = 2355.6948
24@ = 4.9964 

25@ = -2300.3796            
26@ = 2350.199
27@ = 5.0616

28@ = -2293.801         
29@ = 2343.9109
30@ = 5.5853 
jump @Rake_Start


:Rake_Start 
Model.Load(6@)
if
    not model.Available(6@)
then
    repeat
    wait 0
    model.Load(6@)
    until model.Available(6@)
end
038B: load_requested_models 

repeat
wait 0
04ED: load_animation  "PedEventsMod"
until 04EE:   animation "PedEventsMod" loaded

Actor.Create(1@, 21, 6@, 10@, 11@, 12@)   
0E24: fix_char 1@ ground 1 brightness 1 and_fade_in 0 
0F02:  1@ special_model 31@ bone 24 offset 0 0 0 rotation 0 0 0 scale 0@ // bone 34 left hand, 24 right hand, 9 had, 3 tors
0E30: set_render_object_auto_hide 0@ dead 1 weapon 1 car 1
0669: 5@ = create_attached_particle "vent" on_actor 1@ with_offset 0.496 -0.021 0.9 flag 1 
0883: attach_particle 5@ to_actor 1@ mode 24
0AC1: 7@ = load_audio_stream_with_3d_support "SQ/Rake.mp3" // IF and SET
0AC4: link_3d_audio_stream 7@ to_actor 1@
0ABC: set_audio_stream 7@ volume 0.0
Model.destroy(6@)

while true
wait 0
    if
        056D:   actor 1@ defined
    then
        04C4: store_coords_to 2@ 3@ 4@ from_actor 1@ with_offset 0.0 0.0 0.0
        if and
            0EE4: locate_char_distance_to_char $PLAYER_ACTOR char 1@ radius 150.0
            $ACTIVE_INTERIOR == 0
        then
        
            0EFF: get_char_simplest_active_task 1@ id_to 2@ pointer_to 4@
            if and
                2@ == 203 // task stand still
                not Actor.Animation(1@) == "rake"
                not Actor.Animation(1@) == "rakelook"
            then
                if or
                    00FE:   actor 1@ sphere 0 in_sphere 10@ 11@ 12@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 13@ 14@ 15@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 16@ 17@ 18@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 19@ 20@ 21@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 22@ 23@ 24@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 25@ 26@ 27@ radius 2.0 2.0 2.0
                    00FE:   actor 1@ sphere 0 in_sphere 28@ 29@ 30@ radius 2.0 2.0 2.0
                then
                    0209: 2@ = random_int_in_ranges 1 3 // random animation
                    if
                        2@ == 1
                    then
                        0812: AS_actor 1@ perform_animation "rake" IFP "PedEventsMod" framedelta 4.0 loopA 1 lockX 1 lockY 1 lockF 1 time -1
                    end
                    if
                        2@ == 2
                    then
                        0812: AS_actor 1@ perform_animation "rakelook" IFP "PedEventsMod" framedelta 4.0 loopA 1 lockX 1 lockY 1 lockF 1 time -1
                    end
                    wait 100
                    0AAD: set_audio_stream 7@ state 1
                    0AC0: audio_stream 7@ looped 1
                    continue
                end
            end

            if and
                not Actor.Animation(1@) == "rake"
                not Actor.Animation(1@) == "rakelook"
            then
                0AAD: set_audio_stream 7@ state 0
            end
            
            if or
                Actor.Animation(1@) == "rake"
                Actor.Animation(1@) == "rakelook"
            then
                if
                    Actor.Animation(1@) == "rake"
                then
                    0613: 4@ = actor 1@ animation "rake" time
                end
                if
                    Actor.Animation(1@) == "rakelook"
                then
                    0613: 4@ = actor 1@ animation "rakelook" time
                end

                // particle
                if and
                    0EE4: locate_char_distance_to_char $PLAYER_ACTOR char 1@ radius 20.0
                    Actor.Animation(1@) == "rake"
                then
                    if and
                        4@ >= 0.1
                        4@ <= 0.7
                    then
                        0ABC: set_audio_stream 7@ volume 0.2
                        0EC0: add_fx_system_particle 5@ coord 0.6 -0.021 1.0 vel 0 0 0 size 0.6 brightness 0.0 rgba 0.5 0.6 0.3 0.3 lastFactor 0.3
                    else
                        0ABC: set_audio_stream 7@ volume 0.0
                    end
                end

                if and
                    0EE4: locate_char_distance_to_char $PLAYER_ACTOR char 1@ radius 20.0
                    Actor.Animation(1@) == "rakelook"
                then
                    if and
                        4@ >= 0.5
                        4@ <= 0.8
                    then
                        0ABC: set_audio_stream 7@ volume 0.2
                        0EC0: add_fx_system_particle 5@ coord 0.6 -0.021 1.0 vel 0 0 0 size 0.6 brightness 0.0 rgba 0.5 0.6 0.3 0.3 lastFactor 0.3
                    else
                        0ABC: set_audio_stream 7@ volume 0.0
                    end
                end

                // if animation ended, walk another position
                if
                    4@ >= 0.95
                then
                    0209: 2@ = random_int_in_ranges 1 20 // random walk
                    0208: 4@ = random_float_in_ranges 0.0 360.0
                    if 2@ < 8
                    then 0A1A: actor 1@ perform_walk_animation "SweepWalk2" IFP "PedEventsMod" framedelta 4.0 loopA 1 lockX 0 lockY 0 lockF 0 -1 ms // versionC
                    end
                    if
                        2@ == 1
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 10@ 11@ 12@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 2
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 13@ 14@ 15@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 3
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 16@ 17@ 18@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 4
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 19@ 20@ 21@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 5
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 22@ 23@ 24@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 6
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 25@ 26@ 27@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ == 7
                    then
                        0AAD: set_audio_stream 7@ state 0
                        07CD: AS_actor 1@ walk_to 28@ 29@ 30@ stop_with_angle 4@ within_radius 1.0
                    end
                    if
                        2@ >= 8
                    then
                        wait 1000 // for animation again
                    end
                    wait 100
                    continue
                end
            end

            0D59: get_current_weather_to 3@
            0E40: get_current_hour 4@
            080E: get_actor 1@ ped_event_to 2@
            if or
                0118:   actor 1@ dead
                3@ == 8 // not weather rain
                3@ == 16 // not weather rain 2
                4@ >= 15 // timeout
                2@ == 9 // ped damaged
                2@ == 49 // shoot close ped
            then
                0AAE: remove_audio_stream 7@
                0650: destroy_particle 5@
                if 056D:   actor 1@ defined
                then 01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
                end
                04EF: release_animation "PedEventsMod"
                jump @Rake
            end
            
            080E: get_actor 1@ ped_event_to 2@
            if or
                2@ == 15
                2@ == 31
                2@ == 59
            then
                0AAE: remove_audio_stream 7@
                0650: destroy_particle 5@
                if 056D:   actor 1@ defined
                then 01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
                end
                04EF: release_animation "PedEventsMod"
                jump @Rake
            end
            
            //    
            if
                0457:   player $PLAYER_CHAR aiming_at_actor 1@
            then
                0E83: get_current_char_weaponinfo $PLAYER_ACTOR store_to 2@
                0E89: get_weaponinfo_fire_type 2@ store_to 3@ //     
                if or
                    3@ == 1 //  
                    3@ == 3 //   (  ..)
                then
                    0AAE: remove_audio_stream 7@
                    0650: destroy_particle 5@
                    if 056D:   actor 1@ defined
                    then 01C2: remove_references_to_actor 1@ // Like turning an actor into a random pedestrian
                    end
                    04EF: release_animation "PedEventsMod"
                    jump @Rake
                end
            end
            
        else
            gosub @Remove
            wait 1000
            jump @Rake
        end
    else
        gosub @Remove
        wait 1000
        jump @Rake
    end
end


:Remove
0AAE: remove_audio_stream 7@
0650: destroy_particle 5@
if 056D:   actor 1@ defined
then 009B: destroy_actor 1@
end
04EF: release_animation "PedEventsMod"
return

// By ArtemQa146